from airbot_py import airbot_play, airbot_grpc
from utils_py.utils_positions import *
import time
import json


left_arm = airbot_play.create_agent(ip="localhost", port=50001)
# left_arm.set_target_pose(right_arm_zero)
# left_arm.offline_mode()
# replay('say_goodbye')

left_arm.calibrate_robot()
time.sleep(10)
left_arm.calibrate_confirm()



# left_arm.set_robot_mode(airbot_grpc.airbot_play_pb2.AirbotMode.DEMONSTRATE_PREP)
left_arm.set_target_pose(left_arm_zero)
# time.sleep(5)
# print(left_arm.online_mode())
# print(left_arm.state)
print(left_arm.offline_mode())
# left_arm.set_robot_mode(airbot_grpc.airbot_play_pb2.AirbotMode.DEMONSTRATING)
# left_arm.record_start()
# time.sleep(10)
# left_arm.record_stop()
left_arm.replay_start()
time.sleep(10)
# left_arm.record_stop()
print("stop")

# print("1111")
# left_arm.set_target_pose(left_arm_zero)
# flag1 = left_arm.calibrate_robot()
# print(f"flag1 = {flag1}")
# time.sleep(10)
# flag2 = left_arm.calibrate_confirm()
# print(f"flag2 = {flag2}")
# time.sleep(5)
# flag3 = left_arm.launch_robot()
# print(f"flag3 = {flag3}")
# left_arm.set_target_pose(right_arm_zero)

# right_arm = airbot_play.create_agent(ip="localhost", port=50001)
# flag1 = left_arm.calibrate_robot()
# print(f"flag1 = {flag1}")
# time.sleep(10)
# flag2 = left_arm.calibrate_confirm()
# print(f"flag2 = {flag2}")